﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;

namespace ConsoleApp4
{
    class Logon
    {
        public static void Register(string birthday, out int year, out int month, out int day,out bool bol)
        {
            int[] indexs = new int[3];                              //设置数组，储存‘/’的位置
            int i = 0;
            
                int index = birthday.IndexOf('/');                  //查找第一个‘/’位置
                
                while (index != -1)                                 //查找全部‘/’位置
                {
                    indexs[i] = index;
                    index = birthday.IndexOf('/', index + 1);

                    i++;
                }
            
            try                                                     //异常判断
            {
                year = Convert.ToInt32(birthday.Substring(0, indexs[0]));                                    //分割出 年
                month = Convert.ToInt32(birthday.Substring(indexs[0] + 1, (indexs[1]) - (indexs[0]) - 1));   //分割出 月
                day = Convert.ToInt32(birthday.Substring(indexs[1] + 1));                                    //分割出日
                bol = true;                //文本正常输出

            }

            catch                          //异常处理
            {
                year = 0;
                month = 0;
                day = 0;
                bol = false;              //文本不输出
                   

                Console.WriteLine("老子TM代码写这么久，你TM乱写，去死吧傻逼"); };     //异常提示

            
        }
       
        public static void Age( ref int age,int year)
        {
            age = age - year;               //计算年龄
        }
        public static void Speak( int year, int  month, int day,int age)
        {
          
                Console.WriteLine("你的生日是{0}年，{1}月，{2}日,你今年{3}岁", year, month, day, age);            //最后输出的文本
            
           
        }
    }
    
}
